package com.litong.litongjiaoyu.exception;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName ApiExceptionHandler
 * @Description
 * @Author jingz
 * @Date 2020/2/1 19:28
 * @Version
 **/
@RestControllerAdvice()
public class ApiExceptionHandler {
    @ExceptionHandler(ApiRRException.class)
    public Object handleApiRRException(ApiRRException e) {
        Map<String, Object> result = new HashMap<>();
        result.put("errno", e.getErrno());
        result.put("errmsg", e.getErrmsg());
        return result;
    }
}
